//
//  TDCarDetailScrollCell.m
//  TBRentClient
//
//  Created by tonbright on 2018/6/5.
//  Copyright © 2018年 tonbright. All rights reserved.
//

#import "TDCarDetailScrollCell.h"
#import "SDCycleScrollView.h"

@interface TDCarDetailScrollCell()<SDCycleScrollViewDelegate>
@property (nonatomic, strong) SDCycleScrollView *cycleScrollView;
@end
@implementation TDCarDetailScrollCell

- (void)awakeFromNib {
    [super awakeFromNib];
    SDCycleScrollView *cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 0, Width, 220) delegate:self placeholderImage:[UIImage imageNamed:@"home_banner_default"]];
    cycleScrollView.autoScrollTimeInterval = 5;
    cycleScrollView.pageDotImage = [[UIImage imageNamed:@"矩形白色"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    cycleScrollView.currentPageDotImage = [UIImage imageNamed:@"矩形黑色"];
    cycleScrollView.pageControlDotSize = CGSizeMake(20, 5);
    self.cycleScrollView = cycleScrollView;
    [self.view_content addSubview:cycleScrollView];
}


- (void)setDetailCarModel:(TDCarSourceDetailModel *)detailCarModel {
    _detailCarModel = detailCarModel;
    
    NSMutableArray *tmpImageArray = [NSMutableArray array];
    NSArray *tmpArray = detailCarModel.materiallist;
    for (TDCarSourceEnumCarModel *enumModel in tmpArray) {
        NSString *tmpImageUrl = [NSString stringWithFormat:@"http://121.40.92.131/deepdriving/%@",enumModel.linkurl];
        [tmpImageArray addObject:tmpImageUrl];
    }
    self.cycleScrollView.imageURLStringsGroup = tmpImageArray;
    
    _lbe_brandnm.text = [NSString stringWithFormat:@"%@ %@",detailCarModel.brandnm,detailCarModel.seriesnm];
    _lbe_typenm.text = detailCarModel.typenm;
    _lbe_price.text = [NSString stringWithFormat:@"厂商指导价：%@万",detailCarModel.leaseamt];

}



#pragma mark - SDCycleScrollViewDelegate
- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index {
//    UINavigationController *nav = [BOAssistor getCurrentNav];
//    BaseWebViewController *vc = [[BaseWebViewController alloc] initWithUrl:[NSURL URLWithString:@"http://www.baidu.com"]];
//    [nav pushViewController:vc animated:YES];
}

@end
